/*
jQuery Fieldtag Plugin
    * Version 1.1
    * 2009-05-07 10:10:35
    * URL: http://ajaxcssblog.com/jquery/fieldtag-watermark-inputfields/
    * Description: jQuery Plugin to dynamically tag an inputfield, with a class and/or text
    * Author: Matthias Jäggli
    * Copyright: Copyright (c) 2009 Matthias Jäggli under dual MIT/GPL license.
*/

(function($){$.fn.fieldtag=function(options){var opt=$.extend({markedClass:"tagged",standardText:false},options);$(this).focus(function(){if(!this.changed){this.clear();}}).blur(function(){if(!this.changed){this.addTag();}}).keyup(function(){this.changed=($(this).val()?true:false);}).each(function(){this.title=$(this).attr("title");if($(this).val()==$(this).attr("title")){this.changed=false;}
this.clear=function(){if(!this.changed){$(this).val("").removeClass(opt.markedClass);}}
this.addTag=function(){$(this).val(opt.standardText===false?this.title:opt.standardText).addClass(opt.markedClass);}
if(this.form){this.form.tagFieldsToClear=this.form.tagFieldsToClear||[];this.form.tagFieldsToClear.push(this);if(this.form.tagFieldsAreCleared){return true;}
this.form.tagFieldsAreCleared=true;$(this.form).submit(function(){$(this.tagFieldsToClear).each(function(){this.clear();});});}}).keyup().blur();return $(this);}})(jQuery);


/* jquery fancyzooom */

/*
 fancyzooom core
*/

(function($){$.fn.fancyzoom=function(userOptions){var oOverlay=$('<div>').css({height:'100%',width:'100%',position:'fixed',zIndex:100,left:0,top:0,cursor:"wait"});function openZoomBox(imgSrc,o){if(o.showoverlay){oOverlay.appendTo('body').click(function(){closeZoomBox(o)});if($.browser.msie&&$.browser.version<7){oOverlay.css({position:'absolute',height:$(document).height(),width:$(document).width()})}}var oImgZoomBox=o.oImgZoomBox;pos=imgSrc.offset();o=$.extend(o,{imgSrc:imgSrc,dimOri:{width:imgSrc.outerWidth(),height:imgSrc.outerHeight(),left:pos.left,top:pos.top,'opacity':1}});if(!imgSrc.is('img')){o.dimOri=$.extend(o.dimOri,{width:0,height:0})}oImgZoomBox.css({'text-align':'center','border':'0px solid red'}).appendTo('body');var iWidth=oImgZoomBox.outerWidth();var iHeight=oImgZoomBox.outerHeight();dimBoxTarget=$.extend({},{width:iWidth,height:iHeight,'opacity':1},__posCenter((iWidth),(iHeight+30)));o.oImgClose.css({left:(dimBoxTarget.left+dimBoxTarget.width-15),top:(dimBoxTarget.top-15)});var $fctEnd=function(){if($.fn.shadow&&o.shadow&&!$.browser.msie){$('img:first',oImgZoomBox).shadow(o.shadowOpts)}if(o.Speed>0&&!$.browser.msie){o.oImgClose.fadeIn('slow');$('div',oImgZoomBox).fadeIn('slow')}else{o.oImgClose.show();$('div',oImgZoomBox).show()}};$('div',oImgZoomBox).hide();if(o.imgSrc.is('img')){o.imgSrc.css({'opacity':0})}var oImgDisplay=$('img:first',oImgZoomBox).css({'width':'100%','height':'auto'});if(o.Speed>0){oImgZoomBox.css(o.dimOri).animate(dimBoxTarget,o.Speed,$fctEnd)}else{oImgZoomBox.css(dimBoxTarget);$fctEnd()}}function closeZoomBox(o){var oImgZoomBox=o.oImgZoomBox;o.oImgClose.remove();$('div',oImgZoomBox).remove();var endClose=function(){oImgZoomBox.empty().remove();o.imgSrc.css('opacity',1)};if(o.Speed>0){var pos=oImgZoomBox.offset();var iPercent=0.15;var oDimPlus={width:(oImgZoomBox.width()*(1+iPercent)),height:(oImgZoomBox.height()*(1+iPercent)),left:(pos.left-(oImgZoomBox.width()*(iPercent/2))),top:(pos.top-(oImgZoomBox.height()*(iPercent/2)))};oImgZoomBox.animate(oDimPlus,o.Speed*0.2,function(){oImgZoomBox.animate(o.dimOri,o.Speed,function(){endClose()});if(o.showoverlay){oOverlay.animate({'opacity':0},o.Speed,function(){$(this).remove()})}})}else{endClose();if(o.showoverlay){oOverlay.remove()}}}return this.each(function(){var $this=$(this);var imgTarget=$this.is('img')?$this:($('img:first',$this).length==0)?$this:$('img:first',$this);var imgTargetSrc=null;if($this.attr('href')){imgTargetSrc=$this.attr('href')}var oImgClose=$('<img class="jqfancyzoomclosebox">').css({position:'absolute',top:0,left:0,cursor:'pointer'});var opts=$.extend({},$.fn.fancyzoom.defaultsOptions,userOptions||{},{dimOri:{},oImgZoomBoxProp:{position:'absolute',left:0,top:0},oImgClose:oImgClose});if(imgTarget.is('img')){var oImgHover=$("<img src='"+opts.imgDir+"zoom.png'>").css({position:'absolute',top:0,left:0});imgTarget.hover(function(){if(imgTarget.css('opacity')!=0){oImgHover.appendTo(imgTarget.parent()).hide();var pos=imgTarget.position();var marginLeft=parseInt(imgTarget.css('margin-left').replace(/px/,''));var marginTop=parseInt(imgTarget.css('margin-top').replace(/px/,''));marginTop=(marginTop)?marginTop:0;marginLeft=(marginLeft)?marginLeft:0;oImgHover.css({left:(pos.left+marginLeft-12),top:(pos.top+marginTop-12)}).show();if($.fn.ifixpng){oImgHover.ifixpng(opts.imgDir+'blank.gif')}}},function(){oImgHover.remove()})}if($this.is('img')){imgTargetSrc=$this.css('cursor','pointer').attr('src');if(opts.imgResizeScript){if(imgTargetSrc.match(new RegExp("^"+opts.imgResizeScript,"g"))){imgTargetSrc=imgTargetSrc.replace(/.*img=([^&]*).*/gi,'$1')}}}oOverlay.css({opacity:opts.overlay,background:opts.overlayColor});if(!/\.jpg|\.jpeg|\.png|\.gif/i.test(imgTargetSrc)){return true}$this.click(function(){var zoomOpened=$('div.jqfancyzoombox');if(zoomOpened.length>0){if($('img:first',zoomOpened).attr('src')!=imgTargetSrc){if(oLoading&&oLoading.is(':visible')){__cancelLoading()}}else{return false}}var o=$.extend({},opts,userOptions);var closeBtn=$("img.jqfancyzoomclosebox");if(closeBtn.length>0){var imCurrent=$('img:first',zoomOpened);if(imgTargetSrc==imCurrent.attr('src')){pos=imgTarget.offset();o=$.extend(o,{dimOri:{width:(imgTarget.outerWidth()),height:(imgTarget.outerHeight()),left:pos.left,top:(pos.top),'opacity':0}});closeZoomBox(o);return false}else{closeBtn.trigger('click')}}if(o.showoverlay&&oOverlay){oOverlay.empty().remove().css({'opacity':o.overlay})}oImgClose.attr('src',o.imgDir+'closebox.png').appendTo('body').hide();if($.fn.ifixpng){$.ifixpng(o.imgDir+'blank.gif');oImgClose.ifixpng(o.imgDir+'blank.gif')}oImgClose.unbind('click').click(function(){closeZoomBox(o)});var oImgZoomBox=$('<div class="jqfancyzoombox"></div>').css(o.oImgZoomBoxProp);o=$.extend(o,{oImgZoomBox:oImgZoomBox});var strTitle=imgTarget.attr('alt');if(strTitle){var oTitle=$('<div><center><table height=0 border="0" cellspacing=0 cellpadding=0><tr><td></td><td class="fancyTitle">'+strTitle+'</td><td></td></table></center></div>').css({marginTop:10,marginRight:15});var tdL=oTitle.find('td:first').css({'background':'url('+o.imgDir+'zoom-caption-l.png)',width:'13px',height:'26px'});var tdR=oTitle.find('td:last').css({'background':'url('+o.imgDir+'zoom-caption-r.png)',width:'13px',height:'26px'});var tdC=$('.fancyTitle',oTitle).css({'background':'url('+o.imgDir+'zoom-caption-fill.png)','padding':'0px 20px',color:'#FFF','font-size':'14px'});if($.fn.ifixpng){tdL.ifixpng(o.imgDir+'blank.gif');tdR.ifixpng(o.imgDir+'blank.gif');tdC.ifixpng(o.imgDir+'blank.gif')}oTitle.appendTo(oImgZoomBox)}var oImgZoom=$('<img />').attr('src',imgTargetSrc).click(function(){closeZoomBox(o)}).prependTo(oImgZoomBox);var imagezindex=opts.imagezindex;oOverlay.css('zIndex',imagezindex-1);oImgZoomBox.css('zIndex',imagezindex);oImgClose.css('zIndex',(imagezindex+10));var imgPreload=new Image();imgPreload.src=imgTargetSrc;var $fctEndLoading=function(){if(bCancelLoading){bCancelLoading=false}else{if(__getFileName(imgPreload.src)==__getFileName($('img:first',oImgZoomBox).attr('src'))){fctCalculateImageSize(o.autoresize);openZoomBox(imgTarget,o);__stoploading()}}};var fctCalculateImageSize=function(autoresize){if(autoresize){var divCalculate=$('<div></div>').css({position:'absolute','top':0,'left':0,opacity:0,'border':'0px solid red'});var bResize=false;oImgZoom.appendTo(divCalculate);divCalculate.appendTo('body');imWidth=oImgZoom.width();imHeight=oImgZoom.height();maxWidth=$(window).width()*0.9;maxHeight=$(window).height()-100;if(maxHeight<imHeight){bResize=true;oImgZoom.height(maxHeight);imWidth=(imWidth*maxHeight)/imHeight;oImgZoom.width(imWidth);if(maxWidth<imWidth){oImgZoom.width(maxWidth);oImgZoom.height(imHeight*maxWidth/imWidth)}}else if(maxWidth<imWidth){bResize=true;oImgZoom.width(maxWidth);oImgZoom.height(imHeight*maxWidth/imWidth)}if(bResize&&o.imgResizeScript){var tWidth=oImgZoom.width();var tHeight=oImgZoom.height();var finalWidth=tWidth;var tabSizes=new Array(1440,1280,1024,800,640,480,360);for(i=0;i<tabSizes.length;i++){if(tWidth>tabSizes[i]){finalWidth=tabSizes[i];break}}oImgZoom.width(finalWidth);oImgZoom.height(parseInt(tHeight*finalWidth/tWidth));var args="img="+encodeURI(oImgZoom.attr('src'));args+="&width="+oImgZoom.width();args+="&height="+oImgZoom.height();oImgZoom.attr('src',o.imgResizeScript+"?"+args)}divCalculate.remove()}oImgZoom.prependTo(oImgZoomBox)};if(imgPreload.complete){fctCalculateImageSize(o.autoresize);openZoomBox(imgTarget,o)}else{__displayLoading(o);imgPreload.onload=function(){$fctEndLoading()}}return false})})};$.fn.fancyzoom.defaultsOptions={overlayColor:'#000',overlay:0.6,imagezindex:100,showoverlay:true,Speed:400,shadow:true,shadowOpts:{color:"#000",offset:4,opacity:0.2},imgDir:'ressources/',imgResizeScript:null,autoresize:true};function __posCenter(iWidth,iHeight){var iLeft=($(window).width()-iWidth)/2+$(window).scrollLeft();var iTop=($(window).height()-iHeight)/2+$(window).scrollTop();iLeft=(iLeft<0)?0:iLeft;iTop=(iTop<0)?0:iTop;return{left:iLeft,top:iTop}}var oLoading=null;var bCancelLoading=false;var timerLoadingImg=null;function __displayLoading(o){if(!oLoading){oLoading=$('<div></div>').css({width:50,height:50,position:'absolute','background':'transparent',opacity:8/10,color:'#FFF',padding:'5px','font-size':'10px'})}oLoading.css(__posCenter(50,50)).html('<img src="'+o.imgDir+'blank.gif" />').click(function(){__cancelLoading()}).appendTo('body').show();timerLoadingImg=setTimeout(function(){__changeimageLoading(o)},400)}function __cancelLoading(){bCancelLoading=true;__stoploading()}function __stoploading(){oLoading.hide().remove();if(timerLoadingImg){clearTimeout(timerLoadingImg);timerLoadingImg=null}}function __changeimageLoading(o){if(oLoading&&!oLoading.is(':visible')){timerLoadingImg=null;return}var $im=$('img',oLoading);if(!$im.attr('src')||/blank\.gif/.test($im.attr('src'))){strImgSrc=o.imgDir+"zoom-spin-1.png"}else{tab=$im.attr('src').split(/[- .]+/);iImg=parseInt(tab[2]);iImg=(iImg<12)?(iImg+1):1;strImgSrc=tab[0]+"-"+tab[1]+"-"+iImg+"."+tab[3]}var pLoad=new Image();pLoad.src=strImgSrc;var $fct=function(){oLoading&&oLoading.css(__posCenter(50,50));$im.attr('src',strImgSrc);timerLoadingImg=setTimeout(__changeimageLoading,100)};if(pLoad.complete){$fct()}else{pLoad.onload=$fct}}function __getFileName(strPath){if(!strPath){return false}var tabPath=strPath.split('/');return((tabPath.length<1)?strPath:tabPath[(tabPath.length-1)])}})(jQuery);


/*
 * jQuery ifixpng plugin
 * (previously known as pngfix)
 * Version 2.0  (04/11/2007)
 * @requires jQuery v1.1.3 or above
 *
 * Examples at: http://jquery.khurshid.com
 * Copyright (c) 2007 Kush M.
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
 
 /**
  *
  * @example
  *
  * optional if location of pixel.gif if different to default which is images/pixel.gif
  * $.ifixpng('media/pixel.gif');
  *
  * $('img[@src$=.png], #panel').ifixpng();
  *
  * @apply hack to all png images and #panel which icluded png img in its css

  * @name ifixpng
  * @type jQuery
  * @cat Plugins/Image
  * @return jQuery
  * @author jQuery Community
  */
 
(function($) {

	/**
	 * helper variables and function
	 */
	$.ifixpng = function(customPixel) {
		$.ifixpng.pixel = customPixel;
	};
	
	$.ifixpng.getPixel = function() {
		return $.ifixpng.pixel || 'ressources/blank.gif';
	};
	
	var hack = {
		ltie7  : $.browser.msie && $.browser.version < 7,
		filter : function(src) {
			return "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='"+src+"')";
		}
	};
	
	/**
	 * Applies ie png hack to selected dom elements
	 *
	 * $('img[@src$=.png]').ifixpng();
	 * @desc apply hack to all images with png extensions
	 *
	 * $('#panel, img[@src$=.png]').ifixpng();
	 * @desc apply hack to element #panel and all images with png extensions
	 *
	 * @name ifixpng
	 */
	 
	$.fn.ifixpng = hack.ltie7 ? function() {
    	return this.each(function() {
			var $$ = $(this);
			var base = $('base').attr('href'); // need to use this in case you are using rewriting urls
			if ($$.is('img') || $$.is('input')) { // hack image tags present in dom
				if ($$.attr('src')) {
					if ($$.attr('src').match(/.*\.png([?].*)?$/i)) { // make sure it is png image
						// use source tag value if set 
						var source = (base && $$.attr('src').substring(0,1)!='/') ? base + $$.attr('src') : $$.attr('src');
						// apply filter
						$$.css({filter:hack.filter(source), width:$$.width(), height:$$.height()})
						  .attr({src:$.ifixpng.getPixel()})
						  .positionFix();
					}
				}
			} else { // hack png css properties present inside css
				var image = $$.css('backgroundImage');
				if (image.match(/^url\(["']?(.*\.png([?].*)?)["']?\)$/i)) {
					image = RegExp.$1;
					$$.css({backgroundImage:'none', filter:hack.filter(image)})
					  .children().children().positionFix();
				}
			}
		});
	} : function() { return this; };
	
	/**
	 * Removes any png hack that may have been applied previously
	 *
	 * $('img[@src$=.png]').iunfixpng();
	 * @desc revert hack on all images with png extensions
	 *
	 * $('#panel, img[@src$=.png]').iunfixpng();
	 * @desc revert hack on element #panel and all images with png extensions
	 *
	 * @name iunfixpng
	 */
	 
	$.fn.iunfixpng = hack.ltie7 ? function() {
    	return this.each(function() {
			var $$ = $(this);
			var src = $$.css('filter');
			if (src.match(/src=["']?(.*\.png([?].*)?)["']?/i)) { // get img source from filter
				src = RegExp.$1;
				if ($$.is('img') || $$.is('input')) {
					$$.attr({src:src}).css({filter:''});
				} else {
					$$.css({filter:'', background:'url('+src+')'});
				}
			}
		});
	} : function() { return this; };
	
	/**
	 * positions selected item relatively
	 */
	 
	$.fn.positionFix = function() {
		return this.each(function() {
			var $$ = $(this);
			var position = $$.css('position');
			if (position != 'absolute' && position != 'relative') {
				$$.css({position:'relative'});
			}
		});
	};

})(jQuery);


(function($) {
	
	$.fn.shadowEnable  = function() { return $(this).find("+ .fx-shadow").show().end();   };
	$.fn.shadowDisable = function() { return $(this).find("+ .fx-shadow").hide().end();   };
	$.fn.shadowDestroy = function() { return $(this).find("+ .fx-shadow").remove().end(); };
	
	$.fn.shadow = function(options) {
		options = $.extend({
			offset:  1,
			opacity: 0.2,
			color:   "#000",
			monitor: false
		}, options || {});
		options.offset -= 1;
		
		return this.each(function() {
			
			// Remove an existing shadow if it exists
			var $element = $(this).shadowDestroy(),
			
			// Create a shadow element
			$shadow = $("<div class='fx-shadow' style='position: relative;'></div>").hide().insertAfter($element);
			
			// Figure the base height and width
			baseWidth  = $element.outerWidth(),
			baseHeight = $element.outerHeight(),
			
			// Get the offset
			position = $element.position(),
			
			// Get z-index
			zIndex = parseInt($element.css("zIndex")) || 0;
			
			// Append smooth corners
			$('<div class="fx-shadow-color fx-shadow-layer-1"></div>').css({ position: 'absolute', opacity: options.opacity - 0.05,  left: options.offset,     top: options.offset,     width: baseWidth + 1, height: baseHeight + 1 }).appendTo($shadow);
			$('<div class="fx-shadow-color fx-shadow-layer-2"></div>').css({ position: 'absolute', opacity: options.opacity - 0.10,  left: options.offset + 2, top: options.offset + 2, width: baseWidth,     height: baseHeight - 3 }).appendTo($shadow);
			$('<div class="fx-shadow-color fx-shadow-layer-3"></div>').css({ position: 'absolute', opacity: options.opacity - 0.10,  left: options.offset + 2, top: options.offset + 2, width: baseWidth - 3, height: baseHeight     }).appendTo($shadow);
			$('<div class="fx-shadow-color fx-shadow-layer-4"></div>').css({ position: 'absolute', opacity: options.opacity,         left: options.offset + 1, top: options.offset + 1, width: baseWidth - 1, height: baseHeight - 1 }).appendTo($shadow);
			
			// Add color
			$("div.fx-shadow-color", $shadow).css("background-color", options.color);
			
			// Set zIndex +1 and make sure position is at least relative
			// Attention: the zIndex will get one higher!
			$element
				.css({
					zIndex: zIndex + 1,
					position: ($element.css("position") == "static" ? "relative" : "")
				});
			
			// Copy the original z-index and position to the clone
			// alert(shadow); If you insert this alert, opera will time correctly!!
			$shadow.css({
				position:     "absolute",
				zIndex:       zIndex,
				top:          position.top+"px",
				left:         position.left+"px",
				width:        baseWidth,
				height:       baseHeight,
				marginLeft:   $element.css("marginLeft"),
				marginRight:  $element.css("marginRight"),
				marginBottom: $element.css("marginBottom"),
				marginTop:    $element.css("marginTop")
			}).fadeIn();
			
			
			if ( options.monitor ) {
				function rearrangeShadow() {
					var $element = $(this), $shadow = $element.next();
					// $shadow.css( $element.position() );
					$shadow.css({
						top:  parseInt($element.css("top"))  +"px",
						left: parseInt($element.css("left")) +"px"
					})
					$(">*", $shadow).css({ height: this.offsetHeight+"px", width: this.offsetWidth+"px" });
				}
			
				// Attempt to use DOMAttrModified event
				$element.bind("DOMAttrModified", rearrangeShadow);
			
				// Use expressions if they exist (IE)
				if( $shadow[0].style.setExpression ) {
					$shadow[0].style.setExpression("top" , "parseInt(this.previousSibling.currentStyle.top ) + 'px'");
					$shadow[0].style.setExpression("left", "parseInt(this.previousSibling.currentStyle.left) + 'px'");
				}
			}

		});
	};
	
})(jQuery);


/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-08-17 13:14:11 -0500 (Fri, 17 Aug 2007) $
 * $Rev: 2759 $
 *
 * Version: 1.1.2
 *
 * Requires: jQuery 1.1.3+
 */
(function($){var height=$.fn.height,width=$.fn.width;$.fn.extend({height:function(){if(!this[0])error();if(this[0]==window)if($.browser.opera||($.browser.safari&&parseInt($.browser.version)>520))return self.innerHeight-(($(document).height()>self.innerHeight)?getScrollbarWidth():0);else if($.browser.safari)return self.innerHeight;else
return $.boxModel&&document.documentElement.clientHeight||document.body.clientHeight;if(this[0]==document)return Math.max(($.boxModel&&document.documentElement.scrollHeight||document.body.scrollHeight),document.body.offsetHeight);return height.apply(this,arguments);},width:function(){if(!this[0])error();if(this[0]==window)if($.browser.opera||($.browser.safari&&parseInt($.browser.version)>520))return self.innerWidth-(($(document).width()>self.innerWidth)?getScrollbarWidth():0);else if($.browser.safari)return self.innerWidth;else
return $.boxModel&&document.documentElement.clientWidth||document.body.clientWidth;if(this[0]==document)if($.browser.mozilla){var scrollLeft=self.pageXOffset;self.scrollTo(99999999,self.pageYOffset);var scrollWidth=self.pageXOffset;self.scrollTo(scrollLeft,self.pageYOffset);return document.body.offsetWidth+scrollWidth;}else
return Math.max((($.boxModel&&!$.browser.safari)&&document.documentElement.scrollWidth||document.body.scrollWidth),document.body.offsetWidth);return width.apply(this,arguments);},innerHeight:function(){if(!this[0])error();return this[0]==window||this[0]==document?this.height():this.is(':visible')?this[0].offsetHeight-num(this,'borderTopWidth')-num(this,'borderBottomWidth'):this.height()+num(this,'paddingTop')+num(this,'paddingBottom');},innerWidth:function(){if(!this[0])error();return this[0]==window||this[0]==document?this.width():this.is(':visible')?this[0].offsetWidth-num(this,'borderLeftWidth')-num(this,'borderRightWidth'):this.width()+num(this,'paddingLeft')+num(this,'paddingRight');},outerHeight:function(options){if(!this[0])error();options=$.extend({margin:false},options||{});return this[0]==window||this[0]==document?this.height():this.is(':visible')?this[0].offsetHeight+(options.margin?(num(this,'marginTop')+num(this,'marginBottom')):0):this.height()+num(this,'borderTopWidth')+num(this,'borderBottomWidth')+num(this,'paddingTop')+num(this,'paddingBottom')+(options.margin?(num(this,'marginTop')+num(this,'marginBottom')):0);},outerWidth:function(options){if(!this[0])error();options=$.extend({margin:false},options||{});return this[0]==window||this[0]==document?this.width():this.is(':visible')?this[0].offsetWidth+(options.margin?(num(this,'marginLeft')+num(this,'marginRight')):0):this.width()+num(this,'borderLeftWidth')+num(this,'borderRightWidth')+num(this,'paddingLeft')+num(this,'paddingRight')+(options.margin?(num(this,'marginLeft')+num(this,'marginRight')):0);},scrollLeft:function(val){if(!this[0])error();if(val!=undefined)return this.each(function(){if(this==window||this==document)window.scrollTo(val,$(window).scrollTop());else
this.scrollLeft=val;});if(this[0]==window||this[0]==document)return self.pageXOffset||$.boxModel&&document.documentElement.scrollLeft||document.body.scrollLeft;return this[0].scrollLeft;},scrollTop:function(val){if(!this[0])error();if(val!=undefined)return this.each(function(){if(this==window||this==document)window.scrollTo($(window).scrollLeft(),val);else
this.scrollTop=val;});if(this[0]==window||this[0]==document)return self.pageYOffset||$.boxModel&&document.documentElement.scrollTop||document.body.scrollTop;return this[0].scrollTop;},position:function(returnObject){return this.offset({margin:false,scroll:false,relativeTo:this.offsetParent()},returnObject);},offset:function(options,returnObject){if(!this[0])error();var x=0,y=0,sl=0,st=0,elem=this[0],parent=this[0],op,parPos,elemPos=$.css(elem,'position'),mo=$.browser.mozilla,ie=$.browser.msie,oa=$.browser.opera,sf=$.browser.safari,sf3=$.browser.safari&&parseInt($.browser.version)>520,absparent=false,relparent=false,options=$.extend({margin:true,border:false,padding:false,scroll:true,lite:false,relativeTo:document.body},options||{});if(options.lite)return this.offsetLite(options,returnObject);if(options.relativeTo.jquery)options.relativeTo=options.relativeTo[0];if(elem.tagName=='BODY'){x=elem.offsetLeft;y=elem.offsetTop;if(mo){x+=num(elem,'marginLeft')+(num(elem,'borderLeftWidth')*2);y+=num(elem,'marginTop')+(num(elem,'borderTopWidth')*2);}else
if(oa){x+=num(elem,'marginLeft');y+=num(elem,'marginTop');}else
if((ie&&jQuery.boxModel)){x+=num(elem,'borderLeftWidth');y+=num(elem,'borderTopWidth');}else
if(sf3){x+=num(elem,'marginLeft')+num(elem,'borderLeftWidth');y+=num(elem,'marginTop')+num(elem,'borderTopWidth');}}else{do{parPos=$.css(parent,'position');x+=parent.offsetLeft;y+=parent.offsetTop;if((mo&&!parent.tagName.match(/^t[d|h]$/i))||ie||sf3){x+=num(parent,'borderLeftWidth');y+=num(parent,'borderTopWidth');if(mo&&parPos=='absolute')absparent=true;if(ie&&parPos=='relative')relparent=true;}op=parent.offsetParent||document.body;if(options.scroll||mo){do{if(options.scroll){sl+=parent.scrollLeft;st+=parent.scrollTop;}if(oa&&($.css(parent,'display')||'').match(/table-row|inline/)){sl=sl-((parent.scrollLeft==parent.offsetLeft)?parent.scrollLeft:0);st=st-((parent.scrollTop==parent.offsetTop)?parent.scrollTop:0);}if(mo&&parent!=elem&&$.css(parent,'overflow')!='visible'){x+=num(parent,'borderLeftWidth');y+=num(parent,'borderTopWidth');}parent=parent.parentNode;}while(parent!=op);}parent=op;if(parent==options.relativeTo&&!(parent.tagName=='BODY'||parent.tagName=='HTML')){if(mo&&parent!=elem&&$.css(parent,'overflow')!='visible'){x+=num(parent,'borderLeftWidth');y+=num(parent,'borderTopWidth');}if(((sf&&!sf3)||oa)&&parPos!='static'){x-=num(op,'borderLeftWidth');y-=num(op,'borderTopWidth');}break;}if(parent.tagName=='BODY'||parent.tagName=='HTML'){if(((sf&&!sf3)||(ie&&$.boxModel))&&elemPos!='absolute'&&elemPos!='fixed'){x+=num(parent,'marginLeft');y+=num(parent,'marginTop');}if(sf3||(mo&&!absparent&&elemPos!='fixed')||(ie&&elemPos=='static'&&!relparent)){x+=num(parent,'borderLeftWidth');y+=num(parent,'borderTopWidth');}break;}}while(parent);}var returnValue=handleOffsetReturn(elem,options,x,y,sl,st);if(returnObject){$.extend(returnObject,returnValue);return this;}else{return returnValue;}},offsetLite:function(options,returnObject){if(!this[0])error();var x=0,y=0,sl=0,st=0,parent=this[0],offsetParent,options=$.extend({margin:true,border:false,padding:false,scroll:true,relativeTo:document.body},options||{});if(options.relativeTo.jquery)options.relativeTo=options.relativeTo[0];do{x+=parent.offsetLeft;y+=parent.offsetTop;offsetParent=parent.offsetParent||document.body;if(options.scroll){do{sl+=parent.scrollLeft;st+=parent.scrollTop;parent=parent.parentNode;}while(parent!=offsetParent);}parent=offsetParent;}while(parent&&parent.tagName!='BODY'&&parent.tagName!='HTML'&&parent!=options.relativeTo);var returnValue=handleOffsetReturn(this[0],options,x,y,sl,st);if(returnObject){$.extend(returnObject,returnValue);return this;}else{return returnValue;}},offsetParent:function(){if(!this[0])error();var offsetParent=this[0].offsetParent;while(offsetParent&&(offsetParent.tagName!='BODY'&&$.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return $(offsetParent);}});var error=function(){throw"Dimensions: jQuery collection is empty";};var num=function(el,prop){return parseInt($.css(el.jquery?el[0]:el,prop))||0;};var handleOffsetReturn=function(elem,options,x,y,sl,st){if(!options.margin){x-=num(elem,'marginLeft');y-=num(elem,'marginTop');}if(options.border&&(($.browser.safari&&parseInt($.browser.version)<520)||$.browser.opera)){x+=num(elem,'borderLeftWidth');y+=num(elem,'borderTopWidth');}else if(!options.border&&!(($.browser.safari&&parseInt($.browser.version)<520)||$.browser.opera)){x-=num(elem,'borderLeftWidth');y-=num(elem,'borderTopWidth');}if(options.padding){x+=num(elem,'paddingLeft');y+=num(elem,'paddingTop');}if(options.scroll&&(!$.browser.opera||elem.offsetLeft!=elem.scrollLeft&&elem.offsetTop!=elem.scrollLeft)){sl-=elem.scrollLeft;st-=elem.scrollTop;}return options.scroll?{top:y-st,left:x-sl,scrollTop:st,scrollLeft:sl}:{top:y,left:x};};var scrollbarWidth=0;var getScrollbarWidth=function(){if(!scrollbarWidth){var testEl=$('<div>').css({width:100,height:100,overflow:'auto',position:'absolute',top:-1000,left:-1000}).appendTo('body');scrollbarWidth=100-testEl.append('<div>').find('div').css({width:'100%',height:200}).width();testEl.remove();}return scrollbarWidth;};})(jQuery);
/* end jquery fancyzooom */